import fetch from "@/fetch";

// 获取班级列表
export const getClassList = (params) => {
  return fetch({
    method: "get",
    url: "/class/getClass",
    params,
  });
};

// 获取班级详情
export const getClassDetailsList = (params) => {
  return fetch({
    method: "get",
    url: "/class/getClassDetails",
    params,
  });
};

// 修改班级信息
export const updateClass = (params) => {
  return fetch({
    method: "get",
    url: "/class/updateClass",
    params,
  });
};

// 重置密码
export const resetPwd = (params) => {
  return fetch({
    method: "post",
    url: "/class/resetPwd",
    data: params,
  });
};

// 添加学生用户信息
export const saveStu = (params) => {
  return fetch({
    method: "post",
    url: "/class/save",
    data: params,
    loading: true,
  });
};

// 修改学生用户信息
export const updateStu = (params) => {
  return fetch({
    method: "post",
    url: "/class/updateStu",
    data: params,
  });
};

// 学生退出班级
export const quitClass = (params) => {
  return fetch({
    method: "get",
    url: "/class/quitClass",
    params,
  });
};

// // 验证用户是否存在
// export const verifyUser = (params) => {
//   return fetch({
//     method: "post",
//     url: "/class/verifyUser",
//     data: params,
//   });
// };

// 练习记录（老师）
export const statisticList = (params) => {
  return fetch({
    method: "get",
    url: "/statistic/list",
    params,
  });
};

// 练习记录（个人）
export const statisticDetails = (params) => {
  return fetch({
    method: "get",
    url: "/statistic/practiceRecordDetails",
    params,
  });
};

// 班级学习统计
export const listLearnStatistic = (params) => {
  return fetch({
    method: "get",
    url: "/statistic/listLearnStatistic",
    params,
  });
};

// 学习详情
export const learnDetails = (params) => {
  return fetch({
    method: "get",
    url: "/statistic/learnDetails",
    params,
  });
};

// 验证班级名重复
export const isExistClass = (params) => {
  return fetch({
    method: "get",
    url: "/class/isExistClass",
    params,
  });
};

// 获取老师班级列表 选择框
export const getSelectClassList = () => {
  return fetch({
    method: "get",
    url: "/class/classList",
  });
};

// 删除班级
export const deleteClass = (params) => {
  return fetch({
    method: "get",
    url: "/class/delete",
    params,
    loading: true,
  });
};

// 获取个人信息
export const getUserInfo = () => {
  return fetch({
    method: "get",
    url: "/user/getInfo",
  });
};

// 教师登录-获取错题集
export const getTeacherStatistic = (params) => {
  return fetch({
    method: "get",
    url: "/errorBook/teacherStatistic",
    params,
  });
};

// 学生登录-获取错题记录
export const getUserStatistic = () => {
  return fetch({
    method: "get",
    url: "/errorBook/userStatistic",
  });
};

// 学生登录-查看错题答案
export const getErrorBookAnswer = (params) => {
  return fetch({
    method: "get",
    url: "/errorBook/answer",
    params
  });
};

// 学生登录-错题练习
export const getErrorBookPractice = (params) => {
  return fetch({
    method: "get",
    url: "/errorBook/practice",
    params
  });
};

// 学生登录-错题练习提交
export const getErrorBookPracticeSubmit = (params) => {
  return fetch({
    method: "post",
    url: "/errorBook/submit",
    data:params
  });
};
